﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlServerCe;

namespace Tireguit.Nmon.CompactDb
{
    public class DatabaseHelper
    {
        
        public string name = "Tireguit.Nmon.CompactDb.Properties.Settings.NmonDatabaseConnectionString";
        public string connectionString = "Data Source=NmonDatabase.sdf";
        public string providerName = "Microsoft.SqlServerCe.Client.3.5";
        //protected static SqlCeEngine _sqlengine = new SqlCeEngine(connectionString);
        protected static DatabaseHelper _instance = null;
        public static DatabaseHelper Instance
        {
            get
            {
                if (_instance==null)
                {
                    _instance = new DatabaseHelper();
                }
                return _instance;
            }
            set
            {
                _instance = value;
            }
        }
        protected IDbConnection _connection=null;

        public IDbConnection Connection
        {
            get
            {
                if (_connection == null)
                {

                    _connection = new SqlCeConnection(connectionString);
                }
                return _connection;
            }
            set
            {
                _connection = value;
            }
        }
    }
}
